import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'
import './directive'
import './permission'

// 导入全局组件并全局注册
import ArticleItem from '@/components/ArticleItem'
import { formatTimeAgoFn } from '@/utils/date.js'

// 导入vant组件
import {
  NavBar,
  Form,
  Field,
  Button,
  Tabbar,
  TabbarItem,
  Icon,
  Tab,
  Tabs,
  Cell,
  List,
  PullRefresh,
  ActionSheet,
  Dialog,
  Row,
  Col,
  Popup,
  Badge,
  Search,
  Divider,
  Tag,
  CellGroup,
  Image,
  DatetimePicker
} from 'vant'

Vue.component(ArticleItem.name, ArticleItem)
// 把公共函数加到vue的原型上
Vue.prototype.formatTimeAgoFn = formatTimeAgoFn
Vue.use(NavBar)
Vue.use(Icon)
Vue.use(Form)
Vue.use(Field)
Vue.use(Button)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(Cell)
Vue.use(List)
Vue.use(PullRefresh)
Vue.use(ActionSheet)
Vue.use(Dialog)
Vue.use(Popup)
Vue.use(Row)
Vue.use(Col)
Vue.use(Badge)
Vue.use(Search)
Vue.use(Divider)
Vue.use(Tag)
Vue.use(CellGroup)
Vue.use(Image)
Vue.use(DatetimePicker)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
